<%@page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@page import="java.util.List"%>
<%@page import="java.util.ArrayList"%>
<%@page import="entity.Emp"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>emplist</title>
		<link rel="stylesheet" type="text/css" href="css/style.css" />
	</head>
	<body>
		<div id="wrap">
			<div id="top_content">
				<%@include file="header.jsp"%>
				<div id="content">
					<p id="whereami">
					</p>
					<h1>
						Welcome!
					</h1>
					<table class="table">
						<tr class="table_header">
							<td>
								ID
							</td>
							<td>
								Name
							</td>
							<td>
								Salary
							</td>
							<td>
								Age
							</td>
							<td>
								Operation
							</td>
						</tr>
						<c:choose>
							<c:when test="${empty emps}">
								<tr class="row1">
									<td colspan="5" align="center">
										no data
									</td>
								</tr>
							</c:when>
							<c:otherwise>

								<c:forEach var="e" items="${emps}" varStatus="status">
									<tr class="row${status.index%2+1 }">
										<td>
											${e.id }
										</td>
										<td>
											${e.name }
										</td>
										<td>
											${e.salary }
										</td>
										<td>
											${e.age }
										</td>
										<td>
											<a href="delete.do?id=${e.id }"
												onclick="return confirm('删除？')">delete emp</a>&nbsp;
											<a href="loadEmp.do?id=${e.id }">update emp</a>
										</td>
									</tr>
								</c:forEach>
							</c:otherwise>
						</c:choose>

					</table>
					<p>
						<input type="button" class="button" value="Add Employee"
							onclick="location='addEmp.jsp'" />
					</p>
				</div>
			</div>
			<%@include file="footer.jsp"%>
		</div>
	</body>
</html>
